package com.wodsy.phoenix.dataobject.shoppingcart.model;

// Generated 2015-5-15 14:59:21 by Hibernate Tools 3.4.0.CR1

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.wodsy.phoenix.dataobject.base.PhoenixObject;

/**
 * TbShoppingcart generated by hbm2java
 */
@Entity
@Table(name = "tb_shoppingcart", catalog = "shoppingcartc")
public class Shoppingcart extends PhoenixObject {

	private Long id;
	private int buyerUserId;
	private byte source;
	private Date createTime;
	private Date updateTime;

	
	private List<ShoppingcartItem> shoppingcartItemList;
	
	@OneToMany(cascade=CascadeType.ALL,mappedBy="shoppingcart", fetch = FetchType.EAGER)
	public List<ShoppingcartItem> getShoppingcartItemList() {
		return shoppingcartItemList;
	}

	public void setShoppingcartItemList(List<ShoppingcartItem> shoppingcartItemList) {
		this.shoppingcartItemList = shoppingcartItemList;
	}

	public Shoppingcart() {
	}

	public Shoppingcart(int buyerUserId, byte source, Date createTime) {
		this.buyerUserId = buyerUserId;
		this.source = source;
		this.createTime = createTime;
	}

	public Shoppingcart(int buyerUserId, byte source, Date createTime,
			Date updateTime) {
		this.buyerUserId = buyerUserId;
		this.source = source;
		this.createTime = createTime;
		this.updateTime = updateTime;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "buyer_user_id", nullable = false)
	public int getBuyerUserId() {
		return this.buyerUserId;
	}

	public void setBuyerUserId(int buyerUserId) {
		this.buyerUserId = buyerUserId;
	}

	@Column(name = "source", nullable = false)
	public byte getSource() {
		return this.source;
	}

	public void setSource(byte source) {
		this.source = source;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", nullable = false, length = 19)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "update_time", length = 19)
	public Date getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	@Override
	public String toString() {
		return "Shoppingcart [id=" + id + ", buyerUserId=" + buyerUserId
				+ ", source=" + source + ", createTime=" + createTime
				+ ", updateTime=" + updateTime + ", shoppingcartItemList="
				+ shoppingcartItemList + "]";
	}
	
	

}
